<%-- 
    Document   : userList
    Created on : Dec 14, 2009, 3:47:22 PM
    Author     : student
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>List of User</title>
    </head>
    <body>
        
        <form name="form1" method="post" action="sgt.onlinetest.controller/ViewUser">
          <table border="1">
            <tr>
              <th colspan="5">List of User</th>
            </tr>
            <tr>
              <td colspan="5">Select User: 
                <label>
                  <input type="text" name="tbxselectuser" id="tbxselectuser">
                  <select name="cbxselect" id="cbxselect">
                    <option>Search By</option>
                    <option value="Username">User Name</option>
                    <option value="Fullname">Full Name</option>
                  </select>
                  <input type="submit" name="btnsearch" id="btnsearch" value="Search">
              </label></td>
            </tr>
            <tr>
              <th>No.</th>
              <th>User Name</th>
              <th>User Fullname</th>
              <th>User Password</th>
              <th>Assigned roles</th>
            </tr>
            <jsp:useBean id="users" class="java.util.List<sgt.onlinetest.entity.User>" scope="request"/>
            <% for (sgt.onlinetest.entity.User u : users) {%>
            <tr>
              <td><%=u.getAutoId()%></td>
              <td><a href="updateuser.jsp?id=<%=u.getAutoId()%>"><%=u.getUsername()%></a></td>
              <td><%=u.getFullname()%></td>
              <td><%=u.getPassword()%></td>
              <td><% for (sgt.onlinetest.entity.Role r : u.getRoles()) {%>
                <%=r.getName()%>
                <%}%></td>
            </tr>
            <%}%>
          </table>
        </form>
        <p>&nbsp;</p>
        <h1>&nbsp;</h1>
</body>
</html>
